Repository navigation
fix(claim): match claimed paths by segment prefix, not substring (#31) - #39
Open
AryanSingh2029 wants to merge 1 commit into
Open
AryanSingh2029 wants to merge 1 commit into
AryanSingh2029 wants to merge 1 commit into
Conversation
…onT#31) _overlaps compared claimed paths with a substring test, so a directory whose name merely contains another claim's name (docs vs mydocs/x.md, src vs lib/src/a.py) raised a false overlap and told an agent to stop and coordinate with someone working elsewhere. Compare path prefixes by whole segment instead: a claim x covers y when y equals x or starts with x.rstrip('/') + '/', checked both directions, via a small _covers helper. Scope is the substring-vs-prefix bug only; path normalisation (MaxonT#32) is left untouched.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #31.
The bug
_overlapscompared claimed paths with a substring test:"docs/" in "mydocs/x.md"isTruefor a substring but the two paths are in different directories, soaisync claimraised a false overlap (exit 3) for cases likedocsvsmydocs/x.mdandsrcvslib/src/a.py— telling an agent to stop and coordinate with someone working somewhere else.The fix
Compare path prefixes by whole segment. A claim
xcoversywhenyequalsxorylies beneath it (ystarts withx.rstrip("/") + "/"), checked in both directions. A small_covers(parent, child)helper carries the rule; the exact-match fast path (bool(fa & fb)) is unchanged.This is confined to the substring-vs-prefix bug. Path normalisation (
./src/a.pyvssrc/a.py, #32) is a separate issue and left untouched.Verification
docs↔docs/guide.md,src/↔src/app.py), an identical file, a trailing-slash spelling (docs/vsdocs), and whole-repo claims (the empty-set branch) are all preserved. Substring traps such aslibvslibrary/xno longer match.test_overlap_matches_path_prefix_not_substringintests/test_collab.pycovering the false alarms and the real-overlap cases.